/**
 * Created by Administrator on 2017/6/27.
 */
var mongoose = require('../db/db');
var CommentSchema = require('../schemas/comment');

CommentSchema.static('findByMovieId', function (id, callback) {
  return this.find({movie: id}).sort({time: 1}).populate('user').populate('replies.user').exec(callback);
});

module.exports = mongoose.model('Comment', CommentSchema);